﻿@using BonjourQuotation.UI.Models.PartialModel
@using MvcCheckBoxList
@model OperationRoomGridViewModel
@{
    Layout = null;

}
<script type="text/javascript">
    var RoomModel;
    var RoomGridcountinvalid;
    InitVendorHotelGrid();
    LoadRoomGrid(false);
    function LoadRoomGrid(IsClientLoad) {
        RoomGridcountinvalid = 0;
        if (!IsClientLoad)
            RoomModel = $(@Html.Raw(Json.Encode(Model))).JSModel();
        var RoomcolumnHeaders = [];
        var Roomcolumns = [];
        var RoomcolWidth = [];
        var RoomcolOrder = [];
        var RoomTitleSingle = [];
        var RoomTitleDouble = [];
        var RoomTitleTwin = [];
        var RoomTitleTriple = [];
        var RoomTitleQuad = [];
        var RoomTitleDriver = [];
        var RoomTitleGuide = [];
        var RoomType = [];
        var RoomFullBoard = ["Yes", "No"];
        var RoomCustomer = [];

        // Init RoomTitle_s
        $(RoomModel[0].RoomTitleSingle).each(function (index, elem) {
            RoomTitleSingle.push(elem.Text);
        });
        $(RoomModel[0].RoomTitleDouble).each(function (index, elem) {
            RoomTitleDouble.push(elem.Text);
        });
        $(RoomModel[0].RoomTitleTwin).each(function (index, elem) {
            RoomTitleTwin.push(elem.Text);
        });
        $(RoomModel[0].RoomTitleTriple).each(function (index, elem) {
            RoomTitleTriple.push(elem.Text);
        });
        $(RoomModel[0].RoomTitleQuad).each(function (index, elem) {
            RoomTitleQuad.push(elem.Text);
        });
        $(RoomModel[0].RoomTitleDriver).each(function (index, elem) {
            RoomTitleDriver.push(elem.Text);
        });
        $(RoomModel[0].RoomTitleGuide).each(function (index, elem) {
            RoomTitleGuide.push(elem.Text);
        });
        // init Room Type
        $(RoomModel[0].RoomType).each(function (index, elem) {
            RoomType.push(elem.Text);
        });
        // init customer
        debugger;
        $(RoomModel[0].RoomFilterCustomer).each(function (index, elem) {
            RoomCustomer.push(elem.Name);
        });
        if (RoomModel[0].OperationRoomDeleteView)
        {
            RoomcolumnHeaders.push($("#RoomDeleteDiv").html());
            Roomcolumns.push({ data: "RoomDelete", renderer: "html" });
            RoomcolOrder.push(RoomModel[0].OperationRoomDeleteLineNo);
            RoomcolWidth.push(60);
        }
        if (RoomModel[0].OperationRoomGroupNameView)
        {
            if (RoomModel[0].ViewRoomGroupName == true)
            {
                RoomcolumnHeaders.push($("#RoomGroupNameDiv").html());
                RoomModel[0].OperationRoomGroupNameEdit ? Roomcolumns.push({ data: "RoomGroupName", type: "text" }) : Roomcolumns.push({ data: "RoomGroupName", type: "text", readOnly: true });
                RoomcolWidth.push(270);
                RoomcolOrder.push(RoomModel[0].OperationRoomGroupNameLineNo);
                $("#RoomGridRoomGroupNameDiv").hide();
            }
            else
                $("#RoomGridRoomGroupNameDiv").show();
        }
        if (RoomModel[0].OperationRoomGroupCodeView)
        {
            if (RoomModel[0].ViewRoomGroupCode == true)
            {
                RoomcolumnHeaders.push($("#RoomGroupCodeDiv").html());
                RoomModel[0].OperationRoomGroupCodeEdit ? Roomcolumns.push({ data: "RoomGroupCode", type: "text" }) : Roomcolumns.push({ data: "RoomGroupCode", type: "text", readOnly: true });
                RoomcolWidth.push(160);
                RoomcolOrder.push(RoomModel[0].OperationRoomGroupCodeLineNo);
                $("#RoomGridRoomGroupCodeDiv").hide();
            }
            else
                $("#RoomGridRoomGroupCodeDiv").show();
        }
        if (RoomModel[0].OperationRoomCustomerView)
        {
            if (RoomModel[0].IsGir)
            {
                if (RoomModel[0].ViewRoomCustomer == true) {
                    RoomcolumnHeaders.push($("#RoomCustomerDiv").html());
                    RoomModel[0].OperationRoomCustomerEdit ? Roomcolumns.push({ data: "RoomCustomer", type: "autocomplete", source: RoomCustomer, strict: false }) : Roomcolumns.push({ data: "RoomCustomer", type: "autocomplete", source: RoomCustomer, strict: false, readOnly: true });
                    RoomcolWidth.push(200);
                    RoomcolOrder.push(RoomModel[0].OperationRoomCustomerLineNo);
                    $("#RoomGridRoomCustomerDiv").hide();
                }
                else
                    $("#RoomGridRoomCustomerDiv").show();
            }
        }
        //else
        //{
        //    if (RoomModel[0].ViewRoomCustomer == true) {
        //        RoomcolumnHeaders.push($("#RoomCustomerDiv").html());
        //        Roomcolumns.push({ data: "RoomCustomer", type: "text", readOnly: true });
        //        RoomcolWidth.push(220);
        //        $("#RoomGridRoomCustomerDiv").hide();
        //    }
        //    else
        //        $("#RoomGridRoomCustomerDiv").show();
        //}
        if (RoomModel[0].OperationRoomPaxView)
        {
            if (RoomModel[0].ViewRoomPax == true)
            {
                RoomcolumnHeaders.push($("#RoomPaxDiv").html());
                Roomcolumns.push({ data: "RoomNoOfPerson", type: "numeric", readOnly: true  });
                RoomcolWidth.push(60);
                RoomcolOrder.push(RoomModel[0].OperationRoomPaxLineNo);
                $("#RoomGridRoomPaxDiv").hide();
            }
            else
                $("#RoomGridRoomPaxDiv").show();
        }
        if (RoomModel[0].OperationRoomRoomTypeView)
        {
            if (RoomModel[0].ViewRoomType == true)
            {
                RoomcolumnHeaders.push($("#RoomTypeDiv").html());
                RoomModel[0].OperationRoomRoomTypeEdit ? Roomcolumns.push({ data: "RoomType", type: "dropdown", source: RoomType }) : Roomcolumns.push({ data: "RoomType", type: "dropdown", source: RoomType, readOnly: true });
                RoomcolWidth.push(130);
                RoomcolOrder.push(RoomModel[0].OperationRoomRoomTypeLineNo);
                $("#RoomGridRoomTypeDiv").hide();
            }
            else
                $("#RoomGridRoomTypeDiv").show();
        }
        if (RoomModel[0].OperationRoomPaxinRoomView)
        {
            if (RoomModel[0].ViewRoomPaxRoom == true)
            {
                RoomcolumnHeaders.push($("#RoomPaxRoomDiv").html());
                RoomModel[0].OperationRoomPaxinRoomEdit ? Roomcolumns.push({ data: "RoomPaxRoom", type: "numeric" }) : Roomcolumns.push({ data: "RoomPaxRoom", type: "numeric", readOnly: true });
                if (RoomModel[0].IsGir) {
                    RoomcolWidth.push(120);
                }
                else {
                    RoomcolWidth.push(180);
                }
                RoomcolOrder.push(RoomModel[0].OperationRoomPaxinRoomLineNo);
                $("#RoomGridRoomPaxRoomDiv").hide();
            }
            else
                $("#RoomGridRoomPaxRoomDiv").show();
        }
        if (RoomModel[0].OperationRoomTitleView)
        {
            if (RoomModel[0].ViewRoomTitle == true)
            {
                RoomcolumnHeaders.push($("#RoomTitleDiv").html());
                RoomModel[0].OperationRoomTitleEdit ? Roomcolumns.push({ data: "RoomSelectedRoomTitle", type: "dropdown" }) : Roomcolumns.push({ data: "RoomSelectedRoomTitle", type: "dropdown", readOnly: true });
                if (RoomModel[0].IsGir) {
                    RoomcolWidth.push(120);
                }
                else {
                    RoomcolWidth.push(170);
                }
                RoomcolOrder.push(RoomModel[0].OperationRoomTitleLineNo);
                $("#RoomGridRoomTitleDiv").hide();
            }
            else
                $("#RoomGridRoomTitleDiv").show();
        }
        if (RoomModel[0].OperationRoomNamesView)
        {
            if (RoomModel[0].ViewRoomNames == true)
            {
                RoomcolumnHeaders.push($("#RoomNamesDiv").html());
                RoomModel[0].OperationRoomNamesEdit ? Roomcolumns.push({ data: "RoomNames", type: "text" }) : Roomcolumns.push({ data: "RoomNames", type: "text", readOnly: true });
                if (RoomModel[0].IsGir) {
                    RoomcolWidth.push(270);
                }
                else {
                    RoomcolWidth.push(400);
                }
                RoomcolOrder.push(RoomModel[0].OperationRoomNamesLineNo);
                $("#RoomGridRoomNamesDiv").hide();
            }
            else
                $("#RoomGridRoomNamesDiv").show();
        }
        if (RoomModel[0].OperationRoomFBoardView)
        {
            if (RoomModel[0].IsGir)
            {
                if (RoomModel[0].ViewRoomFullBoard == true)
                {
                    RoomcolumnHeaders.push($("#RoomFullBoardDiv").html());
                    RoomModel[0].OperationRoomFBoardEdit ? Roomcolumns.push({ data: "RoomFullBoard", type: "dropdown", source: RoomFullBoard }) : Roomcolumns.push({ data: "RoomFullBoard", type: "dropdown", source: RoomFullBoard, readOnly: true });
                    RoomcolWidth.push(70);
                    RoomcolOrder.push(RoomModel[0].OperationRoomFBoardLineNo);
                    $("#RoomGridRoomFullBoardDiv").hide();
                }
                else
                    $("#RoomGridRoomFullBoardDiv").show();
            }
        }
        if (RoomModel[0].OperationRoomFBoardCountView) {
            if (RoomModel[0].IsGir) {
                if (RoomModel[0].ViewRoomFullBoardCount == true) {
                    RoomcolumnHeaders.push($("#RoomFullBoardCountDiv").html());
                    RoomModel[0].OperationRoomFBoardCountEdit ? Roomcolumns.push({ data: "RoomFullBoardCount", type: "numeric" }) : Roomcolumns.push({ data: "RoomFullBoard", type: "numeric", readOnly: true });
                    RoomcolWidth.push(90);
                    RoomcolOrder.push(RoomModel[0].OperationRoomFBoardCountLineNo);
                    $("#RoomGridRoomFullBoardCountDiv").hide();
                }
                else
                    $("#RoomGridRoomFullBoardCountDiv").show();
            }
        }
        if (RoomModel[0].OperationRoomNotesView)
        {
            if (RoomModel[0].ViewRoomNotes == true)
            {
                RoomcolumnHeaders.push($("#RoomNotesDiv").html());
                RoomModel[0].OperationRoomNotesEdit ? Roomcolumns.push({ data: "RoomNotes", type: "text" }) : Roomcolumns.push({ data: "RoomNotes", type: "text", readOnly: true });
                if (RoomModel[0].IsGir) {
                    RoomcolWidth.push(180);
                }
                else {
                    RoomcolWidth.push(300);
                }
                RoomcolOrder.push(RoomModel[0].OperationRoomNotesLineNo);
                $("#RoomGridRoomNotesDiv").hide();
            }
            else
                $("#RoomGridRoomNotesDiv").show();
        }
        for (var ind1 = 0; ind1 < RoomcolOrder.length; ind1++)
            for (var ind2 = ind1 + 1; ind2 < RoomcolOrder.length; ind2++) {
                if (RoomcolOrder[ind2] < RoomcolOrder[ind1]) {
                    var ord = RoomcolOrder[ind2];
                    RoomcolOrder[ind2] = RoomcolOrder[ind1];
                    RoomcolOrder[ind1] = ord;
                    var Header = RoomcolumnHeaders[ind2];
                    RoomcolumnHeaders[ind2] = RoomcolumnHeaders[ind1];
                    RoomcolumnHeaders[ind1] = Header;
                    var Width = RoomcolWidth[ind2];
                    RoomcolWidth[ind2] = RoomcolWidth[ind1];
                    RoomcolWidth[ind1] = Width;
                    var Col = Roomcolumns[ind2];
                    Roomcolumns[ind2] = Roomcolumns[ind1];
                    Roomcolumns[ind1] = Col;
                }
            }

        RoomRedColorRendererForNegative = function (instance, td, row, col, prop, value, cellProperties) {
            Handsontable.renderers.NumericRenderer.apply(this, arguments);
            td.style.color = 'red';
        };

        var Roomdata = RoomModel[0].Rows;
        if ($("#RoomGroupIDTxt").val() == "0")
            return;

        $("#OperRoomGrid").show();
        $('#OperRoomGrid').handsontable({
            data: Roomdata,
            minSpareRows: 1,
            colHeaders: RoomcolumnHeaders,
            colWidths: RoomcolWidth,
            contextMenu: false,
            manualColumnResize: true,
            manualRowResize: true,
            wordWrap: false,
            columns: Roomcolumns,
          //  isEmptyRow: customIsEmptyRow,
            afterChange: function (data, source) {
                debugger;
                if (data != null)
                {
                    CheckOperRoomDataChanges();
                    if (data[0][1] == "RoomCustomer") {
                        ChangeCustomerID(data[0][3], this, data[0][0])
                    }
                    if (data[0][1] == "RoomFullBoard" && data[0][3] == "Yes") {
                        var instance = this;
                        var row = data[0][0];
                        instance.getData()[row].RoomFullBoardCount = instance.getData()[row].RoomNoOfPerson != null ? instance.getData()[row].RoomNoOfPerson : 1;
                        instance.render();
                    }
                    if (data[0][1] == "RoomType") {
                        debugger;
                        var instance = this;
                        var row = data[0][0];
                        ChangeRoomTypeID(data[0][3], instance, row);
                        var cellProp = instance.getCellMeta(row, "RoomSelectedRoomTitle");
                        SetRoomTitleSource(data[0][3], cellProp);
                        instance.getData()[row].RoomSelectedRoomTitle = cellProp.source[0];
                        var PaxcellProp = instance.getCellMeta(row, "RoomNoOfPerson");
                        instance.getData()[row].RoomNoOfPerson = SetPaxSource(data[0][3], PaxcellProp);
                        instance.render();
                    }
                    if (data[0][1] == "RoomFullBoardCount") {
                        debugger
                        var instance = this;
                        var row = data[0][0];
                        var FullBoardCountPaxcellProp = instance.getData()[row].RoomNoOfPerson;
                        if (FullBoardCountPaxcellProp == null) {
                            jAlert("First you must choose room type", "Error!");
                            instance.getData()[row].RoomFullBoardCount = data[0][2];
                        }
                        else if (data[0][3] > FullBoardCountPaxcellProp) {
                            jAlert("Full board count can not be greater then pax", "Error!");
                            instance.getData()[row].RoomFullBoardCount = data[0][2];
                        }
                        instance.render();
                    }
                }
            },
            cells: function (row, col) {
                var cellProp = this;
                if (cellProp.renderer == Handsontable.renderers.NumericRenderer && cellProp.instance.getDataAtCell(row, col) < 0) {
                    cellProp.renderer = RoomRedColorRendererForNegative;
                }
                if (cellProp.prop == "RoomSelectedRoomTitle" && Roomdata.length > 1) {
                    var roomType = Roomdata[row].RoomType;
                    SetRoomTitleSource(roomType, cellProp);
                    return cellProp;
                }

            }
        });

        function SetRoomTitleSource(roomType, cellProp) {
            switch (roomType) {
                case "Single":
                     cellProp.source = RoomTitleSingle;
                    break;
                case "Double":
                    cellProp.source = RoomTitleDouble;
                    break;
                case "Twin":
                    cellProp.source = RoomTitleTwin;
                    break;
                case "Triple":
                    cellProp.source = RoomTitleTriple;
                    break;
                case "Quad":
                    cellProp.source = RoomTitleQuad;
                    break;
                case "Driver":
                    cellProp.source = RoomTitleDriver;
                    break;
                case "Guide":
                    cellProp.source = RoomTitleGuide;
                    break;
            }
        }
        function SetPaxSource(roomType, PaxcellProp) {
            switch (roomType) {
                case "Single":
                    return 1;
                case "Double":
                    return 2;
                case "Twin":
                    return 2;
                case "Triple":
                    return 3;
                case "Quad":
                    return 4;
                case "Driver":
                    return 0;
                case "Guide":
                    return 0;
            }
        }
        function ChangeRoomTypeID(RoomType, instance, row)
        {
            $(RoomModel[0].RoomType).each(function (index, elem) {
                if (elem.Text == RoomType) {
                    instance.getData()[row].RoomSelectedRoomType = elem.Value;
                }
            });
        }
        function ChangeCustomerID(Customer, instance, row) {
            $(RoomModel[0].RoomFilterCustomer).each(function (index, elem) {
                if (elem.Name == Customer) {
                    instance.getData()[row].RoomCustomerId = elem.Id;
                }
            });
        }
        function customIsEmptyRow(row) {
            var data = $("#OperRoomGrid").handsontable("getData")
            return data[row].RoomDelete;
        }
        if ($("#RoomIsRemoveFilterDivShow").val() == "True") {
            $("#RoomRemoveFiltersDiv").show();
        }
    }
    // Room Grid column Hide Unhide
    function RoomGridColumnHideUnhide(element) {
        var column = $(element).attr('id');
        debugger;
        switch (column) {
            case "RoomGridRoomGroupNameView":
                {
                    if (RoomModel[0].ViewRoomGroupName == true)
                        RoomModel[0].ViewRoomGroupName = false;
                    else
                        RoomModel[0].ViewRoomGroupName = true;
                }
                break;
            case "RoomGridRoomGroupCodeView":
                {
                    if (RoomModel[0].ViewRoomGroupCode == true)
                        RoomModel[0].ViewRoomGroupCode = false;
                    else
                        RoomModel[0].ViewRoomGroupCode = true;
                }
                break;
            case "RoomGridRoomCustomerView":
                {
                    if (RoomModel[0].ViewRoomCustomer == true)
                        RoomModel[0].ViewRoomCustomer = false;
                    else
                        RoomModel[0].ViewRoomCustomer = true;
                }
                break;
            case "RoomGridRoomPaxView":
                {
                    if (RoomModel[0].ViewRoomPax == true)
                        RoomModel[0].ViewRoomPax = false;
                    else
                        RoomModel[0].ViewRoomPax = true;
                }
                break;
            case "RoomGridRoomTypeView":
                {
                    if (RoomModel[0].ViewRoomType == true)
                        RoomModel[0].ViewRoomType = false;
                    else
                        RoomModel[0].ViewRoomType = true;
                }
                break;
            case "RoomGridRoomPaxRoomView":
                {
                    if (RoomModel[0].ViewRoomPaxRoom == true)
                        RoomModel[0].ViewRoomPaxRoom = false;
                    else
                        RoomModel[0].ViewRoomPaxRoom = true;
                }
                break;
            case "RoomGridRoomTitleView":
                {
                    if (RoomModel[0].ViewRoomTitle == true)
                        RoomModel[0].ViewRoomTitle = false;
                    else
                        RoomModel[0].ViewRoomTitle = true;
                }
                break;
            case "RoomGridRoomNamesView":
                {
                    if (RoomModel[0].ViewRoomNames == true)
                        RoomModel[0].ViewRoomNames = false;
                    else
                        RoomModel[0].ViewRoomNames = true;
                }
                break;
            case "RoomGridRoomFullBoardView":
                {
                    if (RoomModel[0].ViewRoomFullBoard == true)
                        RoomModel[0].ViewRoomFullBoard = false;
                    else
                        RoomModel[0].ViewRoomFullBoard = true;
                }
                break;
            case "RoomGridRoomFullBoardCountView":
                {
                    if (RoomModel[0].ViewRoomFullBoardCount == true)
                        RoomModel[0].ViewRoomFullBoardCount = false;
                    else
                        RoomModel[0].ViewRoomFullBoardCount = true;
                }
                break;
            case "RoomGridRoomNotesView":
                {
                    if (RoomModel[0].ViewRoomNotes == true)
                        RoomModel[0].ViewRoomNotes = false;
                    else
                        RoomModel[0].ViewRoomNotes = true;
                }
                break;
            default:
                break;
        }
        LoadRoomGrid(true);
    };
    function RemoveRoomByLine(GroupId, LineNo) {
        UpdateConfirms = true;
        $("#IsRoomRemove").val("True");
        $("#RemoveGroupID").val(GroupId);
        $("#RemoveLineNo").val(LineNo);
        $("#RoomGridUpdate").click();
    }
    function CheckOperRoomDataChanges() {
        if (!$("#OperRoomSaveBtn").hasClass("GridDataChanged"))
            $("#OperRoomSaveBtn").addClass("GridDataChanged");
    }
    // Save Room Grid Data
    function RoomGridSave() {
        debugger;
        var Rows = $('#OperRoomGrid').data('handsontable').getData();
        var SelectedRoomFilterRoomType = [];
        $('#RoomGridRoomTypeMainDiv input[name=SelectedRoomFilterRoomType]:checked').each(function () {
            SelectedRoomFilterRoomType.push($(this).val());
        });
        var SelectedRoomFilterRoomTitle = [];
        $('#RoomGridRoomTitleMainDiv input[name=SelectedRoomFilterRoomTitle]:checked').each(function () {
            SelectedRoomFilterRoomTitle.push($(this).val());
        });
        var SelectedRoomFilterCustomer = [];
        $('#RoomGridCustomerMainDiv input[name=SelectedRoomFilterCustomer]:checked').each(function () {
            SelectedRoomFilterCustomer.push($(this).val());
        });
        var IsValidNames = true;
        var IsValidRoomType = true;
        var IsValidCustomer = true;
        var IsValidFBoard = true;
        var IsValidFBoardCount = true;
        var IsValidFBoardCountWrong = true;
        if (Rows.length > 1) {
            $(Rows).each(function (index, elem) {
                if (index < Rows.length - 1) {
                    // all validations here
                    if (elem.RoomNames == undefined || (elem.RoomNames != undefined && elem.RoomNames.length == 0))
                        IsValidNames = false;
                    if (elem.RoomType == undefined || (elem.RoomType != undefined && elem.RoomType.length == 0))
                        IsValidRoomType = false;
                    if (RoomModel[0].IsGir) {
                        if (elem.RoomCustomer == undefined || (elem.RoomCustomer != undefined && elem.RoomCustomer.length == 0))
                            IsValidCustomer = false;
                        if (elem.RoomFullBoard == undefined || (elem.RoomFullBoard != undefined && elem.RoomFullBoard.length == 0))
                            IsValidFBoard = false;
                        if (elem.RoomFullBoardCount == undefined || (elem.RoomFullBoardCount != undefined && elem.RoomFullBoardCount.length == 0))
                            IsValidFBoardCount = false;
                        if (elem.RoomFullBoardCount != undefined && elem.RoomFullBoardCount <= 0 || (elem.RoomFullBoardCount != undefined && isInt(elem.RoomFullBoardCount) == false))
                            IsValidFBoardCountWrong = false;
                    }
                }
                if (elem.RoomCustomerId == null) {
                    $(RoomModel[0].RoomFilterCustomer).each(function (index1, elem1) {
                        if (elem1.Name == elem.RoomCustomer) {
                            elem.RoomCustomerId = elem1.Id;
                        }
                    });
                }
            });
            
            if (IsValidNames == false) {
                jAlert("Names can't be empty.", "Error!");
                return;
            }
            if (IsValidRoomType == false) {
                jAlert("Room Type can't be empty.", "Error!");
                return;
            }
            if (RoomModel[0].IsGir) {
                if (IsValidCustomer == false) {
                    jAlert("Customer can't be empty.", "Error!");
                    return;
                }
                if (IsValidFBoard == false) {
                    jAlert("Full Board can't be empty.", "Error!");
                    return;
                }
                if (IsValidFBoardCount == false) {
                    jAlert("Full Board count can't be empty.", "Error!");
                    return;
                }
                if (IsValidFBoardCountWrong == false) {
                    jAlert("Full Board count data is invalid.", "Error!");
                    return;
                }
            }
            var OperationRoomGridViewModel = {
                Rows: Rows,
                // show hide
                ViewRoomGroupCode: RoomModel[0].ViewRoomGroupCode,
                ViewRoomGroupName: RoomModel[0].ViewRoomGroupName,
                ViewRoomCustomer: RoomModel[0].ViewRoomCustomer,
                ViewRoomPax: RoomModel[0].ViewRoomPax,
                ViewRoomType: RoomModel[0].ViewRoomType,
                ViewRoomPaxRoom: RoomModel[0].ViewRoomPaxRoom,
                ViewRoomTitle: RoomModel[0].ViewRoomTitle,
                ViewRoomNames: RoomModel[0].ViewRoomNames,
                ViewRoomNotes: RoomModel[0].ViewRoomNotes,
                ViewRoomFullBoard: RoomModel[0].ViewRoomFullBoard,
                ViewRoomFullBoardCount: RoomModel[0].ViewRoomFullBoardCount,
                // search
                RoomGroupNameTxt: RoomModel[0].RoomGroupNameTxt,
                RoomGroupCodeTxt: RoomModel[0].RoomGroupCodeTxt,
                RoomCustomerTxt: RoomModel[0].RoomCustomerTxt,
                // filters
                SelectedRoomFilterRoomType: SelectedRoomFilterRoomType.length > 0 ? SelectedRoomFilterRoomType : [],
                SelectedRoomFilterRoomTitle: SelectedRoomFilterRoomTitle.length > 0 ? SelectedRoomFilterRoomTitle : [],
                SelectedRoomFilterCustomer: SelectedRoomFilterCustomer.length > 0 ? SelectedRoomFilterCustomer : [],
                // SelectedRoomFilterCustomer: RoomModel[0].SelectedRoomFilterCustomer,
                RoomPageNumber: 1,
                RoomGroupIDTxt: $("#RoomGroupIDTxt").val(),
                RoomGroupQuotaID: $("#RoomGroupQuotaID").val(),
            };

            var DTO = JSON.stringify(OperationRoomGridViewModel);

            $.ajax({
                url: urls["OperationRoomGridSave"],
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                data: DTO,
                success: function (data) {
                    // LoadRoomGrid(false);
                    $("#tabRooms").html(data);
                    if ($("#OperRoomMessageInfo").val() != "")
                        jAlert($("#OperRoomMessageInfo").val(), 'Error!');
                },
                error: function (xhr) {
                    //   alert('Error: ' + xhr.statusText);
                },
                complete: function () {
                    //  $("#LoadingDiv").hide();
                    // $("#RoomGridUpSearch").click();
                    LoadHotelGridByGroupCode($("#RoomGroupCodeTxt").val());
                    LoadAttractionsGridByGroupCode($("#RoomGroupCodeTxt").val());
                    LoadMiscGridByGroupCode($("#RoomGroupCodeTxt").val());
                    LoadBusGridByGroupCode($("#RoomGroupCodeTxt").val());
                }
            });
        }
        else
        {
            jAlert("You have not any data for save", "Error!");
        }
    }

    // Load vendor Hotel
    function InitVendorHotelGrid() {
        if ($("#OperRoomMessageInfo").val() != "")
            jAlert($("#OperRoomMessageInfo").val(), 'Error!');
        if ($("#RoomGroupIDTxt").val() == "0")
            return;
        $.ajax({
            url: urls["OperationLoadVendorHotel"],
            data: { 'GroupID': $("#RoomGroupIDTxt").val() },
            type: 'POST',
            success: function (data) {
                $("#VendorHotelDiv").html(data);
            },
            error: function (xhr) {
                //  alert('Error: ' + xhr.statusText);
            },
            complete: function () {
                $("#VendorHotelDiv").show();
            }
        });
    }
    function LoadInvoiceByGroupID(GroupID) {
        // Invoice
        $.ajax({
            url: urls["LoadOperationInvoiceTab"],
            data: {GroupID : GroupID},
            type: 'GET',
            success: function (data) {
                $("#tabInvoice").html(data);
            },
            error: function (xhr) {
                alert('Error: ' + xhr.statusText);
            },
            complete: function () {
                //  $("#LoadingDiv").hide();
                $("#Invoice").click();
            }
        });
    }
    function LoadGirInvoice(GroupID, CustomerID) {
        // Invoice
        $.ajax({
            url: urls["LoadOperationGirInvoice"],
            data: { GroupID: GroupID, CustomerID: CustomerID},
            type: 'GET',
            success: function (data) {
                $("#tabInvoice").html(data);
            },
            error: function (xhr) {
                alert('Error: ' + xhr.statusText);
            },
            complete: function () {
                //  $("#LoadingDiv").hide();
                $("#Invoice").click();
            }
        });
    }

    function LoadGirPricesByQuotaID(QuotaID) {
        debugger;
        $.ajax({
            url: urls["OperationLoadGirPricesByQuotaID"],
            type: 'GET',
            data: { 'QuotaID': QuotaID, 'GroupID': $("#RoomGroupIDTxt").val() },
            success: function (data) {
                $("#GirGroupPricesDiv").show();
                $("#GirGroupPricesDiv").html(data);
                GirGroupPricePopUp();
            },
            error: function (xhr) {
                //   alert('Error: ' + xhr.statusText);
            },
            complete: function () {

            }
        });
    }
    function GirGroupPricePopUp() {
        $.colorbox({
            width: "1212px",
            height: "360px",
            inline: true,
            href: "#GirGroupPricesDiv",
            onClosed: function () {
                $("#GirGroupPricesDiv").hide();
            }
        });
    }
    // report master Rooming List
    $(document).on('click', '#MasterRoomingReportBtn', function () {
        window.open("../Report/MasterRoomingListReport?GroupID=" + $("#RoomGroupIDTxt").val());
    });
    function RoomGridOverwriteAll() {
        $.ajax({
            url: urls["OperationRoomGridOverwriteAll"],
            data: { 'GroupID': $("#RoomGroupIDTxt").val() },
            type: 'POST',
            success: function (data) {
                if (data.errorCode != 0) {
                    jAlert(data.Message, 'Warning!');
                }
                else
                {
                    jAlert("All Rooming List successfully overwrited.", 'Successful!');
                }
            },
        });
    }
    function RoomGridOverwrite(VendorID, ArrivalDate) {
        $.ajax({
            url: urls["OperationRoomGridOverwrite"],
            data: { 'GroupID': $("#RoomGroupIDTxt").val(), 'VendorID': VendorID, 'ArrivalDate': ArrivalDate },
            type: 'POST',
            success: function (data) {
                if (data.errorCode != 0) {
                    jAlert(data.Message, 'Warning!');
                }
                else {
                    jAlert("Rooming List successfully overwrited.", 'Successful!');
                }
            },
        });
    }
    function RemoveRoomFilter(element) {
        debugger
        var columnFilter = $(element).attr('id');
        switch (columnFilter) {
            case "RoomRemoveCustomerFilter":
                {
                    $("#RoomIsRemoveCustomerCodeFilter").val("True");
                }
                break;
            case "RoomRemoveRoomTypeFilter":
                {
                    $("#RoomIsRemoveRoomTypeFilter").val("True");
                }
                break;
            case "RoomRemoveRoomTitleFilter":
                {
                    $("#RoomIsRemoveRoomTitleFilter").val("True");
                }
                break;
            default:
                break;
        }
        $("#IsRoomFilter").val("True");
        $("#RoomGridUpdate").click();
    }
</script>
<div class="OperationTabsTitleDiv">
    <span class="OperationTabsTitle">Rooms</span>
</div>
<div id="VendorHotelDiv" style="padding-right:10px; padding-top:8px; padding-bottom:3px;"></div>

@using (Ajax.BeginForm("SaveOperationRoomGridData", "Operation", new AjaxOptions() { HttpMethod = "Post", OnComplete = "RoomGridAjaxCompleted", UpdateTargetId = "tabRooms", InsertionMode = InsertionMode.Replace }, new { enctype = "multipart/form-data", id = "OperRoomGridForm" }))
{
    @Html.HiddenFor(model => Model.OperRoomMessageInfo)
    <div style="float:left;">
        @Html.HiddenFor(model => Model.RoomGroupIDTxt)
        @Html.TextBoxFor(model => Model.RoomGroupNameTxt, new { @class = "TxtComplete table_inputs_250", @placeholder = "Group Name" })
    </div>
    <div style="float:left;">
        @Html.TextBoxFor(model => Model.RoomGroupCodeTxt, new { @class = "TxtComplete table_inputs_180", @placeholder = "Group Code" })
    </div>
    <div style="float:left;">
        @Html.TextBoxFor(model => Model.RoomCustomerTxt, new { @class = "TxtComplete table_inputs_180", @placeholder = "Customer" })
    </div>
    <button class="btn14 btn50" id="RoomGridUpSearch" type="button">Go</button>
    if (Model.IsGir == true)
    {
        <span style="color:red;">Gir Group</span>
        <span style="color:blue; cursor:pointer; padding-left:6px;" onclick="window.open('../Quotation/Quotation/?QuotaId=@Model.RoomGroupQuotaID')">Quota - @Model.RoomGroupQuotaID</span>
        <button class="btn14 btn60" onclick="LoadGirPricesByQuotaID(@Model.RoomGroupQuotaID)" type="button">Gir Prices</button>
        @Html.HiddenFor(model => model.RoomGroupQuotaID)

        <div id="GirGroupPricesDiv" style="display:none;"></div>
    }
    else if (Model.IsGir == false)
    {
        <button class="btn14 btn60" onclick="LoadInvoiceByGroupID(@Model.RoomGroupIDTxt)" type="button">Invoice</button>
    }
    if (Model.IsGir == true)
    {
        <div id="OperationRoomGirDiv" style="max-height: 140px; max-width:1150px; overflow-y: auto;  margin-top:8px; margin-bottom:8px;">
            <table class="table table-bordered">
                <th>Customer</th>
                <th>Pax</th>
                <th>F. Board</th>
                <th>S. Sup.</th>
                <th>Pr. P.P</th>
                <th>F. Br. Pr.</th>
                <th>S. Sup</th>
                <th>Pr. P.P Cad</th>
                <th>F. Br. Pr. Cad</th>
                <th>S. Sup Cad</th>
                <th>Preview</th>
                <th>Invoice</th>
                <tbody>

                    @for (int ind = 0; ind < Model.GirRows.Count; ind++)
                    {
                        <tr>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirCustomerName, new { @class = "table_inputs_300" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirPax, new { @class = "table_inputs_50" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirFullBoardCount, new { @class = "table_inputs_50" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirSSupCount, new { @class = "table_inputs_50" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirPerPrice, new { @class = "table_inputs_60" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirFullBoardPrice, new { @class = "table_inputs_60" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirSingleSupPrice, new { @class = "table_inputs_60" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirPerPriceCad, new { @class = "table_inputs_60" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirFullBoardPriceCad, new { @class = "table_inputs_60" })
                            </td>
                            <td>
                                @Html.LabelForModel(Model.GirRows[ind].GirSingleSupPriceCad, new { @class = "table_inputs_60" })
                            </td>
                            <td style="text-align:center;">
                                <button class="btn14 btn-danger btn60 btnheight22" onclick="javascript: window.open('../Customer/ManageCustomers?CustomerID=@Model.GirRows[ind].GirFullBoardCustomerID');" type="button">Preview</button>
                            </td>
                            <td style="text-align:center;">
                                @if (Model.GirRows[ind].GirFullBoardGroupID != 0)
                                {
                                    <button class="btn14 btn50 btnheight22" onclick="LoadGirInvoice(@Model.GirRows[ind].GirFullBoardGroupID,@Model.GirRows[ind].GirFullBoardCustomerID)" type="button">-></button>
                                }
                            </td>


                        </tr>
                    }

                </tbody>
            </table>
        </div>
    }
    <div style="@(@Model.Rows != null && @Model.Rows.Count > 0 ? "" : "display:none")">
        @if (@Model.OperationRoomGroupNameView)
        {
            <div id="RoomGridRoomGroupNameDiv" style="@(@Model.ViewRoomGroupName ? "display:none" : "")">
                <div class="RoomGridViewBtnDiv pull-left"><span>Group Name</span><div id="RoomGridRoomGroupNameView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
            </div>
        }
        @if (@Model.OperationRoomGroupCodeView)
        {
            <div id="RoomGridRoomGroupCodeDiv" style="@(@Model.ViewRoomGroupCode ? "display:none" : "")">
                <div class="RoomGridViewBtnDiv"><span>Group Code</span><div id="RoomGridRoomGroupCodeView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
            </div>
        }
        <div id="RoomGridRoomCustomerDiv" style="@(@Model.ViewRoomCustomer ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>Customer</span><div id="RoomGridRoomCustomerView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        <div id="RoomGridRoomPaxDiv" style="@(@Model.ViewRoomPax ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>Pax</span><div id="RoomGridRoomPaxView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        <div id="RoomGridRoomTypeDiv" style="@(@Model.ViewRoomType ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>Room Type</span><div id="RoomGridRoomTypeView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        @if (@Model.OperationRoomPaxinRoomView)
        {
            <div id="RoomGridRoomPaxRoomDiv" style="@(@Model.ViewRoomPaxRoom ? "display:none" : "")">
                <div class="RoomGridViewBtnDiv"><span>Pax in Room</span><div id="RoomGridRoomPaxRoomView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
            </div>
        }
        <div id="RoomGridRoomTitleDiv" style="@(@Model.ViewRoomTitle ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>Title</span><div id="RoomGridRoomTitleView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        <div id="RoomGridRoomNamesDiv" style="@(@Model.ViewRoomNames ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>Names</span><div id="RoomGridRoomNamesView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        <div id="RoomGridRoomFullBoardDiv" style="@(@Model.ViewRoomFullBoard ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>F. Brd</span><div id="RoomGridRoomFullBoardView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        <div id="RoomGridRoomNotesDiv" style="@(@Model.ViewRoomNotes ? "display:none" : "")">
            <div class="RoomGridViewBtnDiv"><span>Notes</span><div id="RoomGridRoomNotesView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div></div>
        </div>
        <div id="RoomRemoveFiltersDiv" class="RemoveFiltersDiv" style="display:none">
            <span class="RemoveFiltersSpan">Filters :</span>
            @if (Model.RoomFilterSelCustomer != null)
            {
                if (Model.RoomFilterSelCustomer.Count > 0)
                {
                    <div class="RoomGridViewBtnDiv"><span>Customer</span><div id="RoomRemoveCustomerFilter" class="RoomGridViewBtn" onclick="RemoveRoomFilter(this)"></div></div>
                    Model.RoomIsRemoveFilterDivShow = true;
                }
            }
            @if (Model.RoomFilterSelRoomType != null)
            {
                if (Model.RoomFilterSelRoomType.Count > 0)
                {
                    <div class="RoomGridViewBtnDiv"><span>Room Type</span><div id="RoomRemoveRoomTypeFilter" class="RoomGridViewBtn" onclick="RemoveRoomFilter(this)"></div></div>
                    Model.RoomIsRemoveFilterDivShow = true;
                }
            }
            @if (Model.RoomFilterSelRoomType != null)
            {
                if (Model.RoomFilterSelRoomTitle.Count > 0)
                {
                    <div class="RoomGridViewBtnDiv"><span>Room Title</span><div id="RoomRemoveRoomTitleFilter" class="RoomGridViewBtn" onclick="RemoveRoomFilter(this)"></div></div>
                    Model.RoomIsRemoveFilterDivShow = true;
                }
            }
        </div>
        <div id="OperRoomGridFilters" style="width:1100px; float: left; padding-top: 12px; padding-right: 5px;padding-bottom: 8px;">
            <div id="RoomGridCustomerMainDiv" class="RoomGridFilterDiv">
                <div class="RoomGridFilterDivClose"></div>
                @Html.CheckBoxListFor(model => model.SelectedRoomFilterCustomer,
                                  model => model.RoomFilterCustomer,
                                  customer => customer.Id,
                                  customer => customer.Name,
                                  model => model.RoomFilterSelCustomer,
                                  MvcCheckBoxList.Model.Position.Vertical)
            </div>
            <div id="RoomGridRoomTypeMainDiv" class="RoomGridFilterDiv">
                <div class="RoomGridFilterDivClose"></div>
                @Html.CheckBoxListFor(model => model.SelectedRoomFilterRoomType,
                                  model => model.RoomFilterRoomType,
                                  type => type.Id,
                                  type => type.Name,
                                  model => model.RoomFilterSelRoomType,
                                  MvcCheckBoxList.Model.Position.Vertical)
            </div>
            <div id="RoomGridRoomTitleMainDiv" class="RoomGridFilterDiv">
                <div class="RoomGridFilterDivClose"></div>
                @Html.CheckBoxListFor(model => model.SelectedRoomFilterRoomTitle,
                                  model => model.RoomFilterRoomTitle,
                                  title => title.Id,
                                  title => title.Name,
                                  model => model.RoomFilterSelRoomTitle,
                                  MvcCheckBoxList.Model.Position.Vertical)
            </div>
        </div>
    </div>
    <div id="OperRoomGrid" class="handsontable" style="width: 1185px; height:280px; overflow:auto; display:none;"></div>
    <div style="display:none;">
        <div id="RoomDeleteDiv">
            <div class="OperationHandsontable">
                <span>Delete</span>
            </div>
        </div>
        <div id="RoomGroupNameDiv">
            <div class="OperationHandsontable">
                <span>Group Name</span>
                @Html.HiddenFor(model => model.ViewRoomGroupName)
                <div id="RoomGridRoomGroupNameView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomGroupCodeDiv">
            <div class="OperationHandsontable">
                <span>Group Code</span>
                @Html.HiddenFor(model => model.ViewRoomGroupCode)
                <div id="RoomGridRoomGroupCodeView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomCustomerDiv">
            <div class="OperationHandsontable">
                <span>Customer</span>
                @Html.HiddenFor(model => model.ViewRoomCustomer)
                <div id="RoomGridRoomCustomerView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationRoomCustomerFilter)
                {
                    if (@Model.IsGir == true)
                    {
                        <div class="RoomGridFilterBtn" id="RoomGridCustomer"></div>
                    }
                }
            </div>
        </div>
        <div id="RoomPaxDiv">
            <div class="OperationHandsontable">
                <span>Pax</span>
                @Html.HiddenFor(model => model.ViewRoomPax)
                <div id="RoomGridRoomPaxView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomTypeDiv">
            <div class="OperationHandsontable">
                <span>Room Type</span>
                @Html.HiddenFor(model => model.ViewRoomType)
                <div id="RoomGridRoomTypeView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationRoomRoomTypeFilter)
                {
                    <div class="RoomGridFilterBtn" id="RoomGridRoomType"></div>
                }
            </div>
        </div>
        <div id="RoomPaxRoomDiv">
            <div class="OperationHandsontable">
                <span>Pax in Room</span>
                @Html.HiddenFor(model => model.ViewRoomPaxRoom)
                <div id="RoomGridRoomPaxRoomView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomTitleDiv">
            <div class="OperationHandsontable">
                <span>Title</span>
                @Html.HiddenFor(model => model.ViewRoomTitle)
                <div id="RoomGridRoomTitleView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
                @if (@Model.OperationRoomTitleFilter)
                {
                    <div class="RoomGridFilterBtn" id="RoomGridRoomTitle"></div>
                }
            </div>
        </div>
        <div id="RoomNamesDiv">
            <div class="OperationHandsontable">
                <span>Names</span>
                @Html.HiddenFor(model => model.ViewRoomNames)
                <div id="RoomGridRoomNamesView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomFullBoardDiv">
            <div class="OperationHandsontable">
                <span>F. Brd</span>
                @Html.HiddenFor(model => model.ViewRoomFullBoard)
                <div id="RoomGridRoomFullBoardView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomFullBoardCountDiv">
            <div class="OperationHandsontable">
                <span>F. Count</span>
                @Html.HiddenFor(model => model.ViewRoomFullBoardCount)
                <div id="RoomGridRoomFullBoardCountView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
        <div id="RoomNotesDiv">
            <div class="OperationHandsontable">
                <span>Notes</span>
                @Html.HiddenFor(model => model.ViewRoomNotes)
                <div id="RoomGridRoomNotesView" class="RoomGridViewBtn" onclick="RoomGridColumnHideUnhide(this)"></div>
            </div>
        </div>
    </div>

    @Html.HiddenFor(model => model.RoomPageNumber)
    @Html.HiddenFor(model => model.IsRoomFilter)

    @Html.HiddenFor(model => model.IsRoomView)
    @Html.HiddenFor(model => model.IsRoomRemove)
    @Html.HiddenFor(model => model.IsRoomSearch)
    @Html.HiddenFor(model => model.RemoveGroupID)
    @Html.HiddenFor(model => model.RemoveLineNo)
    
    @Html.HiddenFor(model => model.RoomIsRemoveFilterDivShow)
    @Html.HiddenFor(model => model.RoomIsRemoveCustomerCodeFilter)
    @Html.HiddenFor(model => model.RoomIsRemoveRoomTypeFilter)
    @Html.HiddenFor(model => model.RoomIsRemoveRoomTitleFilter)
   
    <div class="row form-row" style="@(@Model.Rows != null && @Model.Rows.Count > 0 ? "" : "display:none")">
        @if(Model.OperationPLRoomView)
        { 
            <div class="OperationTabsTitleDiv">
                <span class="OperationTabsTitle">Number of Rooms</span>
            </div>
            if(Model.OperationPLRoomPaxView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; margin-left: 30px;">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize" style="width: 20px !important;">@Html.LabelFor(model => model.TotalPax)</span>
                        @Html.LabelForModel(Model.TotalPax, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomRoomsView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 12% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize" style="width: 5px !important;">@Html.LabelFor(model => model.TotalRooms)</span>
                        @Html.LabelForModel(Model.TotalRooms, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomSGLView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalSgl)</span>
                        @Html.LabelForModel(Model.TotalSgl, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomDBLView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalDbl)</span>
                        @Html.LabelForModel(Model.TotalDbl, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomTWNView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalTwn)</span>
                        @Html.LabelForModel(Model.TotalTwn, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomTRPLView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalTrpl)</span>
                        @Html.LabelForModel(Model.TotalTrpl, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomQUDView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalQud)</span>
                        @Html.LabelForModel(Model.TotalQud, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomDriverView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalDriver)</span>
                        @Html.LabelForModel(Model.TotalDriver, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
            if (Model.OperationPLRoomGuideView)
            { 
                <div class=" col-lg-2 withoutPadding" style="width: 10% !important; ">
                    <div class="input-group">
                        <span class="input-group-addon SumControlsLabelFSize">@Html.LabelFor(model => model.TotalGuide)</span>
                        @Html.LabelForModel(Model.TotalGuide, new { @class = "form-control SumControls12Size" })
                    </div>
                </div>
            }
        }
    </div>
    if (Model.RoomGroupIDTxt > 0)
    {
        @*<input type="button" style="width:60px;" id="HotelPageNum" onclick="RoomPageNumBtnClick()" value="More" />*@
        <button class="btn14 btn60 pull-right" id="OperRoomSaveBtn" style="margin-top:10px; margin-right:13px;" onclick="RoomGridSave()" type="button">Save</button>
        <input type="button" id="MasterRoomingReportBtn" class="btn14  btn90 pull-left" style="margin-top:10px;" value="Preview">
        <input type="button" id="MasterRoomingOverwriteAllBtn" class="btn14  btn90 pull-left" style="margin-top: 10px; margin-left: 10px;" onclick="RoomGridOverwriteAll()" value="Overwrite All">
    }

    <button style="display:none;" id="RoomGridUpdate" type="submit"></button>
}





